Skip to content

Revive for..of optimization #4208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Sep 29, 2024

This revives the effort for us to use ES6 features without sacrificing performance.

We'll transpile for..of statements to

for (let i = 0; i < x.length; i++) {
  const item = x[i]
}

There's a potential optimisation in here to extract x.length outside of the loop so we don't have to access length every time. Another thing we'll have to transpile is array destructuring.

With the automated approach like here we'll still have a lot of for..of where we invoke the iterator of i.e. a map.

Related to #3691

Copy link

netlify bot commented Sep 29, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit fb887db
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/66fbfc15fe8a2d00083d4bbb
😎 Deploy Preview https://deploy-preview-4208--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

Hi @JoviDeCroock, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@JoviDeCroock JoviDeCroock force-pushed the revive-for-of-optimisation branch from 6f9f231 to f1b4893 Compare September 29, 2024 17:17
@JoviDeCroock JoviDeCroock marked this pull request as ready for review September 29, 2024 17:17
@JoviDeCroock JoviDeCroock requested a review from a team as a code owner September 29, 2024 17:17
@JoviDeCroock

This comment has been minimized.

@JoviDeCroock JoviDeCroock force-pushed the revive-for-of-optimisation branch from f1b4893 to 2cffe00 Compare September 29, 2024 17:20
Copy link

@github-actions run-benchmark

@JoviDeCroock Something went wrong, please check log.

@JoviDeCroock JoviDeCroock marked this pull request as draft September 30, 2024 07:45
@JoviDeCroock JoviDeCroock force-pushed the revive-for-of-optimisation branch 2 times, most recently from 6572923 to df82c97 Compare September 30, 2024 07:54
@JoviDeCroock JoviDeCroock force-pushed the revive-for-of-optimisation branch 2 times, most recently from 945a836 to 372ecd8 Compare October 1, 2024 13:34
@JoviDeCroock JoviDeCroock force-pushed the revive-for-of-optimisation branch from 372ecd8 to fb887db Compare October 1, 2024 13:41
@JoviDeCroock
Copy link
Member Author

To be consistent we'd have to translate Set/Map however we rely on those being mutated during runtime which does not boat well.

@JoviDeCroock JoviDeCroock deleted the revive-for-of-optimisation branch October 1, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant